import React from "react"
import Discover from "./Pages/Discover"
import Friends from "./Pages/Friends"
import Mine from "./Pages/Mine"
import Pa404 from "./Pages/Pa404"
import "./Base.css"
import CustomLink from "./customlist"
import { Route, NavLink, Link, withRouter, Switch } from "react-router-dom"
@withRouter
class Base extends React.Component {
    click=()=>{
        // this.props.history.push("/friends")
        // this.props.history.push({pathname:'/friends'})
        this.props.history.push({pathname:'/friends',query:{name:"我是你爸爸"},msg:"我是你爷爷"})
    }
    render() {
        console.log(this.props)
        return (
            <fieldset>
                <legend>基础路由</legend>
                <ul>
                    <li>
                        <CustomLink to="/discover">发现音乐</CustomLink>
                    </li>
                    <li>
                        <CustomLink to="/friends" query="?name:孙悟空">朋友</CustomLink>
                    </li>
                    <li>
                        <CustomLink to="/mine/10086">个人中心</CustomLink>
                    </li>
                   
                </ul>
                <Switch>
                    <Route path="/discover" component={Discover}></Route>
                    <Route path="/friends" component={Friends}></Route>
                    <Route path="/mine/:id(10086|10010|10000)" component={Mine}></Route>
                    <Route path="/test" children={(props) => {
                        console.log(props)
                        return <h1>Route的children属性</h1>
                    }}></Route>
                     <Route component={Pa404}></Route>
                </Switch>
                <button onClick={this.click}>这是一个好玩的按钮</button>
            </fieldset>

        )
    }
}
export default Base